package com.five.mobile.config;

import com.five.mobile.interceptor.AuthInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

@Configuration
public class InterceptorConfig implements WebMvcConfigurer {

    /**
     * 认证拦截器
     */
    @Resource
    private AuthInterceptor authInterceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(authInterceptor)
                .addPathPatterns("/**")
                .excludePathPatterns("/admin/login","/swagger-resources/**",
                        "/webjars/**","/v3/**","/swagger-ui/**","/error","/swagger-ui.html","/favicon.ico",
                        "/category/**","/product/**","/banner/**");
    }
}
